package com.gzwanchuang.xhgj.ui.page.adapter;

import android.util.Log;

import com.chad.library.adapter.base.BaseQuickAdapter;

import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gzwanchuang.xhgj.R;
import com.gzwanchuang.xhgj.proto.Merchantservice;
import com.gzwanchuang.xhgj.ui.utils.StringReplaceUtil;

import java.util.List;

/**
 * 文件名 : ZhanDanAdapter
 * 创建者 : MangoWang
 * 创建日期 : 2019/12/26 15:44
 * 微信 : MangoWaWang
 * 邮箱 : 763482205@qq.com
 * 描述 : TODO
 */
public class KaBaoAdapter extends BaseQuickAdapter<Merchantservice.card, BaseViewHolder> implements LoadMoreModule {
    public KaBaoAdapter(List<Merchantservice.card> data) {
        super(R.layout.item_xin_yong_bank, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Merchantservice.card item) {
        String type = "";
        if (item.getType().equals("CREDIT")) {
            type = "(信用卡)";
            switch (item.getIsVip()) {
                case "1":
                    helper.setGone(R.id.tv_ti_er, false);
                    helper.setText(R.id.tv_ti_er, "VIP");
                    break;
                case "0":
                    helper.setGone(R.id.tv_ti_er, false);
                    helper.setText(R.id.tv_ti_er, "提额");
                    break;
                default:
                    helper.setGone(R.id.tv_ti_er, true);
            }
        } else {
            type = "(银行卡)";
            helper.setGone(R.id.tv_ti_er, true);
        }
        helper.getView(R.id.tv_jie_bang).setTag(item.getId());
        helper.setText(R.id.tv_name, item.getBankName() + type).setText(R.id.tv_number, StringReplaceUtil.bankCardReplaceWithStar(item.getCard()));
    }
}
